import { createRouter, createWebHashHistory } from "vue-router";

const routes = [
  {
    path: "/",
    name: "Home",
    redirect: {
      name: "Login",
    },
  },
  {
    path: "/login",
    name: "Login",
    component: () => import("../views/Login.vue"),
  },
  {
    path: "/reg",
    name: "Reg",
    component: () => import("../views/Reg.vue"),
  },
  {
    path: "/dashboard",
    component: () => import("../views/dashboard/Layout.vue"),
    children: [
      {
        path: "index",
        name: "AdminIndex",
        component: () => import("../views/dashboard/Index.vue"),
      },
      {
        path: "server/list",
        name: "ServerList",
        component: () => import("../views/dashboard/server/List.vue"),
      },
      {
        path: "server/add",
        name: "ServerAdd",
        component: () => import("../views/dashboard/server/Add.vue"),
      },
      {
        path: "server/all",
        name: "ServerAll",
        component: () => import("../views/dashboard/server/All.vue"),
      },
      {
        path: "user/list",
        name: "UserList",
        component: () => import("../views/dashboard/user/List.vue"),
      },
      {
        path: "user/info",
        name: "UserInfo",
        component: () => import("../views/dashboard/user-info/Index.vue"),
      },
    ],
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

export default router;
